<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!---->
<head lang="en">
    <meta charset="UTF-8">
    <title>优客书城数据页</title>
</head>
<body>
		<div class="container">
			<!--左边-->
			<div class="col-md-8 col-sm-12" style="width:100%">
				<!--左边-->
				<ol class="breadcrumb">
					<li>
						<a href="#" class="text-success"><span class="glyphicon glyphicon-heart"></span>&nbsp;&nbsp;图书管理</a>
					</li>
				</ol>

				<!--购物车表格 begin-->
				<div class="table-responsive" id="imgDiv">
					<table class="table table-hover table-striped" style="vertical-align:middle;">
						<thead>

						<tr class="text-success success">
							<!--<th style="width: 30px;">
								<input type="checkbox" id="selectAll" onclick="selectAll(this)">
							</th>-->
							<th id="sequence">序号</th>
							<th>图片</th>
							<th>书名</th>
<!--							<th>作者</th>-->
<!--							<th>出版社</th>-->
							<th>出版时间</th>
							<th>分类</th>
							<th>库存</th>
							<th>原价</th>
							<th>现价</th>
							<th>书本详情</th>
							<th>是否推荐</th>
							<th>上架状态</th>
							<th>操作</th>
						</tr>
						</thead>
						<tbody id="tby" th:each="book,iter:${bookList}">
						<tr>
							<!--<td style="width: 30px;">
								<input type="checkbox" name="cks"  th:value="${book.id}" >
							</td>-->
							<td th:text="${book.id}">1001</td>
							<td id="layer-photos-demo" class="layer-photos-demo">
								<img src="images/tenxunchuan.jpg" th:src="@{'/public/' + ${book.imgUrl}}">
							</td>
							<td th:text="${book.name}">腾讯传</td>
<!--							<td th:text="${book.author}">作者</td>-->
<!--							<td th:text="${book.publisher}">黑龙江科学技术出版社</td>-->
							<td th:text="${#calendars.format(book.publishDate,'yyyy-MM-dd')}">出版时间</td>
							<td th:text="${book.cate}">分类</td>
							<td th:text="${book.count}">100</td>
							<td th:text="${book.oldPrice == 0?'无':book.oldPrice}">原价</td>
							<td th:text="${book.newPrice}">现价00$</td>
							<td style="width: 146px;">
								<button class="btn btn-success" th:onclick="displayInfo([[${book}]],[[${#calendars.format(book.publishDate,'yyyy-MM-dd')}]])">预览</button>
							</td>
							<td th:if="${book.recommend == 0}">否</td>
							<td th:if="${book.recommend == 1}">是</td>
							<td th:if="${book.state == 1}">上架中</td>
							<td th:if="${book.state == 0}">已下架</td>
							<!--<td>
								<a class="btn btn-info" th:href="@{/admin/toUpdateBook(bookId=${book.id})}">修改</a>
								<br>
								<a th:onclick="deleteBook([[${book.id}]])"  class="btn btn-danger">删除</a>
							</td>-->
							<td>
								<select id="" value="操作" class="form-control" style="width: 100px;display: inline;" th:onchange="|operate(this,[[${book.id}]])|">
									<option value=""></option>
									<option value="update">更新</option>
									<option value="offShelf" th:if="${book.state == 1}">下架</option>
									<option value="onShelf" th:if="${book.state == 0}">恢复上架</option>
									<option value="addCount">补充库存</option>
									<option value="changePrice">修改价格</option>
									<option value="setRec" th:if="${book.recommend == 0}">设为推荐</option>
									<option value="setNotRec" th:if="${book.recommend == 1}">设为非推荐</option>
								</select>
							</td>

						</tr>

						</tbody>
						<tfoot>
						<tr>
							<td colspan="5"></td>
							<td class="text-success">总数量:</td>
							<td class="text-success" th:text="${total}+'本'">20本</td>
						</tr>
						<tr style="background-color: white;">
							<td>
								<a th:href="@{/admin/toAddBook}" class="btn btn-info">上架新书＋</a>
							</td>
<!--							<td><button class="btn btn-danger" data-toggle="modal" data-target="#myModal" th:onclick="deleteBooks()">删除商品一</button></td>-->
							<td colspan="4"></td>
<!--							<td>
								<a href="confirm_order.html" class="btn btn-warning">结算商品</a>
							</td>-->
						</tr>
						</tfoot>
					</table>
				</div>
				<!--购物车 end-->

			</div>

			<!--分页begin-->
			<div class="container">
				<div class="row text-center">
					<div class="col-md-12">
						<ul class="pagination">
							<li><a href="javascript:void(0)" th:onclick="loadData(1,[[${pageSize}]])">首页</a></li>
							<li  th:classappend="${cur==1} ? 'disabled':''">
								<a href="javascript:void(0)" th:style="${cur == 1} ? 'pointer-events:none':''" th:onclick="loadData([[${pre}]],[[${pageSize}]])">&laquo;</a>
							</li>
							<li th:each="i:${#numbers.sequence(1,pages)}" th:class="${cur == i} ? 'active' : ''">
								<a href="javascript:void(0)" th:text="${i}" th:onclick="loadData([[${i}]],[[${pageSize}]])">1</a>
							</li>
							<li th:classappend="${cur== pages} ? 'disabled':''">
								<a th:style="${cur == pages} ? 'pointer-events:none':''" href="javascript:void(0)" th:onclick="loadData([[${next}]],[[${pageSize}]])">&raquo;</a>
							</li>
							<li><a href="javascript:void(0)" style="border: 1px solid #ddd;" th:onclick="loadData([[${pages}]],[[${pageSize}]])">尾页</a></li>
							<li><a style="border: 0px;margin-left: 0px;" th:text="${'当前页' + cur + '/' + pages + '总页'}">当前页3/5总页</a></li>
							<li>

								<div id="search" class="input-group" style="positon:relative;">
									<input id="inputPage" type="text" class="form-control" placeholder="跳转指定页" />
									<span class="input-group-btn">
									<button class="btn btn-info btn-search" th:onclick="goPage([[${pageSize}]],[[${pages}]])">GO</button>
								</span>
								</div>
							</li>
							<li><a style="padding-top: 0px;border: 0px;">
								<label>每页显示:</label>
								<select id="pageSize" th:value="${pageSize}" class="form-control" style="width: 100px;display: inline;" th:onchange="|loadDataBySize(this)|">
									<option value="2" th:selected="${pageSize == 2}">2</option>
									<option value="4" th:selected="${pageSize == 4}">4</option>
									<option value="6" th:selected="${pageSize == 6}">6</option>
									<option value="8" th:selected="${pageSize == 8}">8</option>
								</select>
								<label>条</label>
							</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<!--分页end-->
		</div>
</body>

</html>